Skip to content

[CMake] fix plutil runpath for ELF platforms #2999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2021

Conversation

finagolfin
Copy link
Member

Remove the absolute path to the host toolchain's stdlib from plutil, and add it as a CMake BUILD_PATH, so that it's removed upon installation.

The problem is that plutil on linux currently has this rpath:

> readelf -d swift-DEVELOPMENT-SNAPSHOT-2021-05-05-a-centos8/usr/bin/plutil |ag runpath
 0x000000000000001d (RUNPATH)            Library runpath: [/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux]

I submitted this as part of #2783 earlier, but had to remove it because the linux CMake was too old and didn't support BUILD_RPATH then. With swiftlang/swift#37517 updating the linux CMake, this should work now.

@finagolfin
Copy link
Member Author

@drexin, could you look at this?

@finagolfin
Copy link
Member Author

@varungandhi-apple, mind running the CI here?

@drexin
Copy link
Contributor

drexin commented Jun 2, 2021

@swift-ci test

@finagolfin
Copy link
Member Author

The linux CI reports this error:

CMake Error at Sources/Tools/plutil/CMakeLists.txt:18 (message):
  Error getting target info with

    `/home/buildnode/jenkins/workspace/swift-corelibs-foundation-PR-Linux/buildbot_linux/swift-linux-x86_64/bin/swiftc -module-cache-path "/home/buildnode/jenkins/workspace/swift-corelibs-foundation-PR-Linux/buildbot_linux/foundation-linux-x86_64/module-cache" -print-target-info`

  Error:

    <unknown>:0: error: unknown argument: '-module-cache-path "/home/buildnode/jenkins/workspace/swift-corelibs-foundation-PR-Linux/buildbot_linux/foundation-linux-x86_64/module-cache"'

I tried running the same command with a recent official trunk snapshot build, no problem. Technically, the command doesn't need to pass that flag in through CMAKE_Swift_FLAGS, but I'm future-proofing this for swiftlang/swift#33724, where cross-compilation targets will be passed in that way.

I have no idea why this wouldn't work here and the same flag works when building the full Foundation, anyone know?

@finagolfin
Copy link
Member Author

Oh, think I got it, fix incoming.

Remove the absolute path to the host toolchain's stdlib from plutil, and add
it as a CMake BUILD_PATH, so that it's removed upon installation.
@finagolfin
Copy link
Member Author

Alright, had to do with string quoting. I hadn't tested adding that flag first, did so now.

@drexin
Copy link
Contributor

drexin commented Jun 2, 2021

@swift-ci test

@finagolfin
Copy link
Member Author

macOS CI failure is unrelated, linux CI passing means this works.

@finagolfin
Copy link
Member Author

Ping, just needs the macOS CI run again, which this ELF pull doesn't affect, and can get this in.

@varungandhi-apple
Copy link
Contributor

@swift-ci test macOS

@finagolfin
Copy link
Member Author

Some memory issue on the macOS CI? Again unrelated.

@varungandhi-apple varungandhi-apple merged commit 78f2ce5 into swiftlang:main Jun 10, 2021
@varungandhi-apple
Copy link
Contributor

OK-ed by Dario, merged. Sorry about the delay.

@finagolfin finagolfin deleted the plutil-rpath branch June 11, 2021 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants